<template>
  <section class="page">
    <headerbar>换届提醒</headerbar>
    <fetchData  class="inner-content" :loading="isLoading" :data="data"></fetchData>
    <abnormal  @refresh="loadData" v-if="abnormal"></abnormal>
    <section class="inner-content" v-if="!isLoading&&data">
      <section class="detail">
        <!--<h1 class="title">{{data.title}}</h1>
        <p class="date">{{getTime(data.createTime)}}</p>-->
        <!--<p class="line"></p>-->
        <div class="cont-text">
          {{data.nodeMsg}}
        </div>
      </section>

      <div class="cont-img" v-if="data.annexList"  v-saveImage>
        <img class="swiper-slide" v-for="item in data.annexList" :src="tools.getImgUrl(item.fileId)" @click="showImagePreview(item)">
      </div>
    </section>

  </section>
</template>
<script>
  import tools from '@/utils/tools'
  import api from '@/common/config/api'
  import loginService from '@/service/loginService'
  import moment from 'moment'
  export default {
    name: 'newTermReminderDetail',
    data () {
      return {
        isLoading: true,
        abnormal: false,
        fn: tools,
        data: {},
        msgId: '',
        fileList: []
      }
    },
    created () {
      this.loadData()
    },
    methods: {
      loadData () {
        this.abnormal = false
        this.isLoading = true
        let data = {
          loginId: '3750'
        }
        this.fetchService.hjtxInfo(data).then(res => {
          if (res.code !== 0) {
            if (res.code == 444) {
              this.abnormal = true
            } else {
              return tools.tip(res.message)
            }
          }
          this.isLoading = false
          this.data = res.data
        })
      },
      getTime (createTime) {
        return moment(createTime).format('YYYY年MM月DD日')
      },
      showImagePreview (item) {
        if (item.fileId.length < 1) {
          return false
        }
        let fileUrl = this.tools.getImgUrl(item.fileId)
        item.url = fileUrl
        let imgs = [fileUrl]
        this.$createImagePreview({
          initialIndex: 0,
          imgs: imgs
        }, (h) => {
          return h('div', {
            class: {
              'image-preview-custom-header': false
            },
            slot: 'header'
          }, '')
        }).show()
      }
    }
  }
</script>

<style scoped lang="scss">
.cont-img {
  img {
    max-width:100%;

  }
}
</style>
